package com.ld.security.common.mybatis.base.vo;

import com.ld.security.common.core.util.ReflectionUtil;
import com.ld.security.common.mybatis.base.entity.TreeEntity;
import lombok.Data;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
public class GroupVo extends TreeEntity<GroupVo> {



    /**
     * 节点分裂
     * @param fieldName
     * @return
     */
    public GroupVo split(List<?> list,String fieldName) {
        Map<Object,List<Object>> mapList =  list.stream().collect(Collectors.groupingBy(v -> {
            Object val = ReflectionUtil.invokeGetter(v,fieldName);
            return  val;
        }));
        for (Object o : mapList.keySet()) {
            List child =  mapList.get(o);





        }
        return this;
    }



}
